package fr.emn.integration.synthese.presentation;

import java.awt.Dimension;
import java.awt.Frame;
import java.awt.GridLayout;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import fr.emn.integration.synthese.abstraction.Cours;
import fr.emn.integration.synthese.controle.ControlJButtonSaveEncadrant;

public class AjoutEncadrantDialog extends JDialog{
	
	private JTextField nom;
	private JTextField prenom;
	private JTextField mail;
	

	public String getNom() {
		return nom.getText();
	}

	public String getPrenom() {
		return prenom.getText();
	}

	public String getMail() {
		return mail.getText();
	}

	public AjoutEncadrantDialog(Frame parent, Cours modele){
		super(parent, "Encadrants", true);
		this.setMinimumSize(new Dimension(250, 150));
		
		JPanel form = new JPanel (new GridLayout(7,1));
		form.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
		
		form.add(new JLabel("Nom"));
		nom = new JTextField();
		form.add(nom);
		
		form.add(new JLabel("Prenom"));
		prenom = new JTextField();
		form.add(prenom);
		
		form.add(new JLabel ("Mail"));
		mail = new JTextField();
		form.add(mail);
		
		JPanel buttons = new JPanel ();
		JButton save = new JButton("Ok");
		ControlJButtonSaveEncadrant controleSaveEncadrant = new ControlJButtonSaveEncadrant(modele, this);
		save.addActionListener(controleSaveEncadrant);
		
		buttons.add(save);
		form.add(buttons);
		
		this.getContentPane().add(form);
		
		this.pack();
		super.setLocationRelativeTo(parent);
	}
	
	

}
